package com.kkb.kkbportal.domain;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Range;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

;

/**
 * @ClassName BrowsingHistory
 * @Description TODO 浏览历史
 * @Author hxf
 * @Date 2021/8/12
 **/
@Data
/*
包含了 Getter，Setter，RequiredArgsConstructor ，ToString，EqualsAndHashCode5个注解
其中RequiredArgsConstructor包含了 NoArgsConstructor，AllArgsConstructor2个注解
 */
@TableName("project_history")
@ApiModel(value = "BrowsingHistory对象", description = "分布式对象")
public class BrowsingHistory implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "项目历史主键id")
    @NotEmpty
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @NotNull(message = "{projectInfo.filed.notNull}")
    @ApiModelProperty(value = "用户id")
    @TableField("user_id")
    @NotNull(message = "{projectInfo.filed.notNull}")
    private Long userId;

    @ApiModelProperty(value = "项目id")
    @TableField("project_id")
    @NotNull(message = "{projectInfo.filed.notNull}")
    private Long projectId;

    @ApiModelProperty(value = "项目标题")
    @TableField("project_title")
    @NotNull(message = "{projectInfo.filed.notNull}")
    private String projectTitle;

    @ApiModelProperty(value = "项目对于用户的状态")
    @TableField("project_status")
    @NotNull(message = "{projectInfo.filed.notNull}")
    @Range(max = 4, min = 0, message = "0 审核中，1 进行中，2 已完成，3 已取消,4 未报名")
    private Integer projectStatus;

    @ApiModelProperty(value = "报名截止时间")
    @TableField("project_deadline")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @NotNull(message = "{projectInfo.filed.notNull}")
    private Date projectDeadline;

    @ApiModelProperty(value = "创建人")
    @NotNull(message = "{projectInfo.filed.notNull}")
    private String creator;

    @ApiModelProperty(value = "创建时间")
    @TableField("create_time")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date createTime;

    @ApiModelProperty(value = "修改人")
    @NotNull(message = "{projectInfo.filed.notNull}")
    private String updater;

    @ApiModelProperty(value = "修改时间")
    @TableField("update_time")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date updateTime;

    @ApiModelProperty(value = "是否已删除")
    //在字段上加上这个注解再执行BaseMapper的删除方法时，删除方法会变成修改
    @TableLogic
    @TableField("is_deleted")
    @NotNull(message = "{projectInfo.filed.notNull}")
    private Integer deleted;

}
